/**
 * 
 */
package ac.svn.accesscontrol.ui.window;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

import ac.svn.accesscontrol.ui.MarginBorder;
import ac.svn.accesscontrol.utils.Utility;

/**
 * @author Ankush Chaudhary
 *
 */
public class SplashScreen extends JDialog 
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public SplashScreen()
	{
		super();
		setUndecorated(true);
		setAlwaysOnTop(true);
		setLayout(new BorderLayout(5,5));

		setBackground(Color.CYAN);
		String text = "<HTML><h4>Smart CM<h4>" +
				"<br>A utility that will help you manager access rights for your SubVersion repository<br><br>" +
				"-Developed by: <b>Ankush Chaudhary</b></HTML>";


		JPanel basePanel = new JPanel(new BorderLayout(5,5),true); 
		basePanel.setBackground(Color.WHITE);
		basePanel.setBorder(new MarginBorder());

		JLabel label = new JLabel(text);
		label.setFont(new Font("Trebuchet MS",Font.PLAIN,14));
		label.setVerticalAlignment(JLabel.TOP);
		basePanel.add(label,BorderLayout.CENTER);

		label = new JLabel("");	
		label.setIcon(Utility.getImageIcon("images/svn.png"));
		basePanel.add(label,BorderLayout.WEST);

		add(basePanel,BorderLayout.CENTER);

		setLocationAndSize();
		pack();
	}

	private void setLocationAndSize()
	{
		setSize(500,140);
		Dimension sizeOfScr = Toolkit.getDefaultToolkit().getScreenSize();
		setLocation(((int)(sizeOfScr.getWidth()/2 - getWidth()/2)),((int)(sizeOfScr.getHeight()/2 -getHeight()/2)));
	}

	public static void main(String args[])
	{
		SplashScreen screen = new SplashScreen();
		screen.setVisible(true); 
	}
}
